function mk_report(d, dobs, plotrng)

fname = 'Czech_Republic_filter.pdf';
tag='Baseline';

%--start-up the IRIS report object
x = report.new(['Czech Republic -- ' tag],'visible',true);

%--definitions
graphStyleobs;




yellow = [1 1 0];
magenta = [1 0 1];
cyan = [0 1 1];
red = [1 0 0];
green = [0 1 0];
blue = [0 0 1];
white = [1 1 1];
black = [0 0 0];

ontop_line = yellow;
background_line = white;
        
x.figure('Observed Variables','subplot',[3 3],'range',plotrng);  
      x.graph('Nominal Interest Rate -- IB Rates (% p.a)', 'style', generalstyle);
            x.series('rn', d.rn);
            x.series('rn', dobs.RN);
      x.graph('Nominal Exchange rate (100*log)', 'style', generalstyle);
            x.series('', d.ls);
            x.series('', dobs.LS);
      x.graph('Real GDP (100*log)', 'style', generalstyle);
            x.series('lgdp', d.lgdp);
            x.series('lgdp', dobs.LGDP);
      x.graph('CPI (100*log)', 'style', generalstyle);
            x.series('', d.lcpi);
            x.series('', dobs.LCPI);
      x.graph('Foreign output gap (%)', 'style', generalstyle);
            x.series('foreign output gap', d.lx_gdp_gap);
             x.series('foreign output gap', dobs.LX_GDP_GAP);
      x.graph('Nominal interest rate US (%)', 'style', generalstyle);
            x.series('level', d.x_rn);
            x.series('level', dobs.X_RN);
      x.graph('CPI US (100*log )', 'style', generalstyle, 'legend', true, ...
        'postProcess','grfun.movetosubplot(L,3,3,8);');
            x.series('Filtered', d.lx_cpi);
            x.series('Observed', dobs.LX_CPI);
      x.clearpage();

graphStyle;
      x.figure('Observed Variables','subplot',[3 3],'range',plotrng);  
      x.graph('Nominal Interest Rate -- IB Rates (% p.a)', 'style', generalstyle);
            x.series('rn', d.rn);
      x.graph('Nominal Exchange rate (LC per USD)', 'style', generalstyle);
            x.series('', exp(d.ls/100));
      x.graph('Real GDP Growth (YoY, QoQ)', 'style', generalstyle, 'legend', true);
            x.series('YoY', d.dot4_gdp);
            x.series('QoQ', d.dot_gdp);
      x.graph('CPI inflation (%)', 'style', generalstyle, 'legend', true);
            x.series('QoQ', d.dot_cpi);
            x.series('YoY', d.dot4_cpi);
      x.graph('US output gap (%)', 'style', generalstyle);
            x.series('foreign output gap', d.lx_gdp_gap);
      x.graph('Nominal interest rate US (%)', 'style', generalstyle);
            x.series('level', d.x_rn);
      x.graph('CPI US (100*log )', 'style', generalstyle, 'legend', true);
            x.series('QoQ', d.dot_x_cpi);
            x.series('YoY', d.dot4_x_cpi);       
      x.clearpage();
            
     
x.figure('Long-Term Trends: Real Exchange Rate','subplot',[2 2],'range',plotrng);
      x.graph('Real Exchange Rate','style',generalstyle, 'legend', true); %1st subplot
            x.series('Level', d.lz);    
            x.series('Trend', d.lz_eq);
      x.graph('Real Exchange rate growth rate (QoQ %)', 'style', generalstyle, 'legend', true);
            x.series('Level', d.dot_z);  
            x.series('Trend', d.dot_z_eq);
      x.graph('Real Exchange rate gap', 'style', generalstyle);
            x.series('', d.lz_gap);     
      x.clearpage();

x.figure('Decomposition of real exchange rate growth (increase = real depreciation)', 'range=',plotrng);

	thissty = struct();
	thissty.line.lineWidth = {2,1.5};
	thissty.line.color = {background_line, ontop_line}; 
	thissty.axes.xgrid = 'on';
	thissty.axes.ygrid = 'on';
  thissty.legend.location = 'south';
  thissty.legend.orientation = 'horizontal';
        
    x.graph('','legend',true,'style',thissty,'tight',false);
    x.series('',[d.dot_s -d.dot_cpi d.dot_x_cpi], 'plotfunc=',@conbar,'legend=',{'nominal depreciation', 'domestic inflation', 'partner country inflation'}); 
    x.series('',[d.dot_z d.dot_z] ,'legend=',NaN);
    x.clearpage();

      
x.figure('Long-Term Trends: Real Interest Rate','subplot',[2 2],'range',plotrng);          
      x.graph('Real Interest Rate', 'style', generalstyle, 'legend', true);
            x.series('Level rr', d.rr);  
            x.series('Trend rr\_eq', d.rr_eq);
      x.graph('Real Interest Rate Gap', 'style', generalstyle);
            x.series('rr_gap', d.rr_gap);
      x.graph('Premium', 'style', generalstyle, 'legend', true);
            x.series('UIP residuals', -d.dot_s + d.rn - d.x_rn);
            x.series('Prem', d.prem);                   
      x.graph('Real Interest Rate - Foreign', 'style', generalstyle, 'legend', true);
            x.series('Level', d.x_rr);   
            x.series('Trend', d.x_rr_eq);
      x.clearpage();

x.figure('Long-Term Trends: Premium','subplot',[2 2],'range',plotrng);          
      x.graph('Premium', 'style', generalstyle, 'legend', true);
            x.series('UIP residuals', -d.dot_s + d.rn - d.x_rn);          
            x.series('Prem', d.prem);                                       
      x.graph('Exchange Rate Shocks', 'style', generalstyle, 'legend', true);
            x.series('RES UIP', d.e_ls);                                  
            x.series('PREM', d.prem);                                       
      x.clearpage();


x.figure('Long-Term Trends: GDP','subplot',[2 2],'range',plotrng);  
      x.graph('Real GDP (100*log, LC, 2006 prices)','style',generalstyle, 'legend', true); %1st subplot
            x.series('Level', d.lgdp);      
            x.series('Trend', d.lgdp_eq);  
      x.graph('GDP Growth (QoQ %)', 'style', generalstyle, 'legend', true);
            x.series('Level', d.dot_gdp);    
            x.series('Trend', d.dot_gdp_eq);
      x.graph('GDP Growth (YoY %)', 'style', generalstyle, 'legend', true);
            x.series('Level', d.dot4_gdp);   
            x.series('Trend', d.dot_gdp_eq);
      x.graph('Output gap', 'style', generalstyle);
            x.series('', d.lgdp_gap);       
      x.clearpage();  

	  
% Output Gap double figures	  
x.figure('Output Gap', 'range=',plotrng); 
	thissty = struct();
	thissty.line.lineWidth = {2,1.5};
	thissty.line.color = {background_line, ontop_line}; 
  thissty.legend.location = 'southOutside';
  thissty.legend.orientation = 'horizontal';
	x.graph('Decomposition of Model-predicted Output Gap','legend',true,'style',thissty, 'tight',false);
		x.series('',[d.a1*d.lgdp_gap{-1}, -d.a2*d.mci, d.a3*d.lx_gdp_gap], 'plotfunc=',@conbar,'legend=',{'Lagged', 'MCI', 'FX\_Output\_gap'}); 
		x.series('',[d.lgdp_gap-d.e_lgdp_gap d.lgdp_gap-d.e_lgdp_gap] ,'legend=',NaN);
	thissty = struct();
	thissty.line.lineWidth = 2;
	x.graph('Output gap', 'legend=', true, 'style',thissty);
		u = [d.lgdp_gap d.lgdp_gap-d.e_lgdp_gap];
		x.series('',u ,'legend=',{'Observed', 'Model predicted (Observed Minus Demand Shocks)'});
x.clearpage();


x.figure('Inflations','subplot',[2 2],'range',plotrng);  
      x.graph('CPI Inflation QoQ', 'style', generalstyle);
            x.series('CPI', d.dot_cpi);
      x.graph('CPI Inflation YoY', 'style', generalstyle, 'legend', true);
            x.series('YoY', d.dot4_cpi);
            x.series('Target', d.target);
      x.clearpage();      

% Core Inflation double figures	  
x.figure('Core Inflation', 'range=',plotrng);
	thissty = struct();
	thissty.line.lineWidth = {2,1.5};
	thissty.line.color = {background_line, ontop_line}; 
  thissty.legend.location = 'southOutside';
  thissty.legend.orientation = 'horizontal';
	x.graph('Decomposition of Model-predicted Core Inflation','legend',true,'style',thissty, 'tight',false);
		x.series('',[d.b1*d.dot_cpi_x{-1} (1 - d.b1)*d.e_dot_cpi_x d.b2*d.rmc], 'plotfunc=',@conbar,'legend=',{'Lagged','Expected', 'RMC'}); 
		x.series('',[d.b1*d.dot_cpi_x{-1}+(1 - d.b1)*d.e_dot_cpi_x+d.b2*d.rmc d.b1*d.dot_cpi_x{-1}+(1 - d.b1)*d.e_dot_cpi_x+d.b2*d.rmc] ,'legend=',NaN);
	thissty = struct();
	thissty.line.lineWidth = 2;
	x.graph('Core Inflation', 'legend=', true, 'style',thissty);
		u = [d.dot_cpi_x d.dot_cpi_x-d.e_dot_cpi_x];
		x.series('',u ,'legend=',{'Observed', 'Model predicted (Observed Minus Inflationary Shocks)'}); 
x.clearpage();
	  

% Real Marginal Costs double figures	  
x.figure('Real Marginal Costs', 'range=',plotrng);
	thissty = struct();
	thissty.line.lineWidth = {2,1.5};
	thissty.line.color = {background_line, ontop_line}; 
  thissty.legend.location = 'southOutside';
  thissty.legend.orientation = 'horizontal';
	x.graph('Decomposition of Model-predicted RMC','legend',true,'style',thissty, 'tight',false);
		x.series('',[d.b3*d.lgdp_gap  (1-d.b3)*(d.lz_gap)], 'plotfunc=',@conbar,'legend=',{'Output Gap', 'REER Gap'}); 
		x.series('',[d.rmc d.rmc] ,'legend=',NaN);
	thissty = struct();
	thissty.line.lineWidth = 2;
	x.graph('Real Marginal Costs', 'style',thissty);
		x.series('',d.rmc ); 
x.clearpage();


% (MPA model.model mp rule) rn = f1*rn{-1} + (1-f1)*(rn_neutral + f2*(dot4_cpi{+4} - target{+4}) + f3*lgdp_gap) + e_rn;
% or equivalent to: rn = f1*rn{-1} + (1-f1)*(rr_eq + dot4_cpi{+1} + f2*(dot4_cpi{+4} - target{+4}) + f3*lgdp_gap) + e_rn;
% where rn_neutral = rr_eq + dot4_cpi{+1};
% (kenya model mp rule) i = c1_i*i{-1} + (1-c1_i)*(r_tnd + dl_cpi_tar{1} + c2_i*(d4l_cpi{1} - dl_cpi_tar{1}) + c3_i*l_y_gap) + shock_i;
%the difference is that kenya defines rn_neutral as the sum of rn trend and inflation target (dl_cpi_tar), while in MPA rn_neutral is sum of rn_trend and expected
%inflation (dot4_cpi)
%(from Kenya mk_report) u = [d.c1_i*d.i{-1}  (1-d.c1_i)*(d.r_tnd + d.dl_cpi_tar{+1})  (1-d.c1_i)*d.c2_i*(d.d4l_cpi{+1} - d.dl_cpi_tar{+1})  (1-d.c1_i)*d.c3_i*d.l_y_gap ];
% u = [d.f1*d.rn{-1}  (1-d.f1)*(d.rn_neutral + d.target{+1})  (1-d.f1)*d.f2*(d.dot4_cpi{+1} - d.target{+1})  (1-d.f1)*d.f3*d.lgdp_gap ];


% Moenytary Policy double figures	  
x.figure('Monetary Policy Rate', 'range=',plotrng);
	thissty = struct();
	thissty.line.lineWidth = {2,1.5};
	thissty.line.color = {background_line, ontop_line}; 
  thissty.legend.location = 'southOutside';
  thissty.legend.orientation = 'horizontal';
	x.graph('Decomposition of Model-predicted Interbank Rate','legend',true,'style',thissty, 'tight',false);
		x.series('',[d.f1*d.rn{-1}  (1-d.f1)*(d.rn_neutral)  (1-d.f1)*d.f2*(d.dot4_cpi{+4} - d.target{+4})  (1-d.f1)*d.f3*d.lgdp_gap ], 'plotfunc=',@conbar,'legend=',{'Lagged', 'Policy Neutral Rate', 'Inflation Deviation', 'Output Gap'}); 
		x.series('',[d.rn-d.e_rn d.rn-d.e_rn] ,'legend=',NaN);
	thissty = struct();
	thissty.line.lineWidth = 2;
	x.graph('Monetary Policy (Interbank) Rate', 'legend=', true, 'style',thissty);
		u = [d.rn d.rn-d.e_rn];
		x.series('',u ,'legend=',{'Observed', 'Observed minus MP shocks'}); 
x.clearpage();


x.figure('Foreign block (1)', 'subplot', [2 2],'range', plotrng);
    x.graph('Nom. Interest  rate -- Foreign', 'style', generalstyle, 'legend', true);
        x.series('Observed', d.x_rn);
        x.series('Filtered', d.x_rn - d.e_x_rn);
    x.graph('Output gap -- Foreign', 'style', generalstyle, 'legend', true);
        x.series('Observed', d.lx_gdp_gap);
        x.series('Filtered', d.lx_gdp_gap - d.e_lx_gdp_gap);
    x.graph('Inflation QoQ -- Foreign', 'style', generalstyle, 'legend', true);
        x.series('Observed', d.dot_x_cpi);
        x.series('Filtered', d.dot_x_cpi - d.e_dot_x_cpi);
    x.clearpage();

x.figure('Shocks (1)', 'subplot', [2 3],'range', plotrng);
    x.graph('e_lgdp_gap', 'style', generalstyle);
        x.series('level', d.e_lgdp_gap);
    x.graph('e_dot_cpi', 'style', generalstyle);
        x.series('level', d.e_dot_cpi);      
    x.graph('e_rn', 'style', generalstyle);
        x.series('level', d.e_rn);
    x.graph('e_dot_z_eq', 'style', generalstyle);
        x.series('level', d.e_dot_z_eq);
    x.graph('e_target', 'style', generalstyle);
        x.series('level', d.e_target);    
    x.graph('e_cr_prem', 'style', generalstyle);
        x.series('level', d.e_cr_prem);
    x.clearpage();

x.figure('Shocks (2)', 'subplot', [1 2],'range', plotrng);
    x.graph('e_dot_gdp_eq', 'style', generalstyle);
        x.series('level', d.e_dot_gdp_eq);
    x.graph('e_rr_eq', 'style', generalstyle);
        x.series('level', d.e_rr_eq);
    x.clearpage();

x.figure('Shocks (3)', 'subplot', [2 3],'range', plotrng);
    x.graph('e_prem', 'style', generalstyle);
        x.series('level', d.e_prem);
    x.graph('e_lx_gdp_gap', 'style', generalstyle);
        x.series('level', d.e_lx_gdp_gap);  
    x.graph('e_x_rn', 'style', generalstyle);
        x.series('level', d.e_x_rn);    
    x.graph('e_x_rr_eq', 'style', generalstyle);
        x.series('level', d.e_x_rr_eq);
    x.graph('e_dot_x_cpi', 'style', generalstyle);
        x.series('level', d.e_dot_x_cpi);
    x.clearpage();
%here

x.publish(fname,...
    'maketitle',true,...
    'deletelatex',true,'display',false);